# -*- mode: python -*-

Import(
    [
        "env",
    ]
)

env = env.Clone()

env.SConscript(
    must_exist=1,
    dirs=[
        "boolean_simplification",
        "bson",
        "ce",
        "client_cursor",
        "collation",
        "cost_based_ranker",
        "datetime",
        "optimizer",
        "plan_cache",
        "query_settings",
        "query_stats",
        "query_shape",
        "query_tester",
        "search",
        "stage_builder/sbe",
        "stats",
        "virtual_collection",
        "write_ops",
    ],
    exports=[
        "env",
    ],
)

env.CppUnitTest(
    target="command_diagnostic_printer_test",
    source=[],
    LIBDEPS=[],
)

env.CppUnitTest(
    target="express_execution_test",
    source=[],
    LIBDEPS=[],
)

env.CppUnitTest(
    target="db_query_test",
    source=[],
    LIBDEPS=[],
)

env.Benchmark(
    target="canonical_query_bm",
    source=["canonical_query_bm.cpp"],
    LIBDEPS=[
        "$BUILD_DIR/mongo/db/matcher/expressions_mongod_only",
        "$BUILD_DIR/mongo/db/query/canonical_query",
        "$BUILD_DIR/mongo/db/query/query_test_service_context",
    ],
    CONSOLIDATED_TARGET="query_bm",
)

env.Benchmark(
    target="query_planner_bm",
    source=[
        "query_planner_bm.cpp",
    ],
    LIBDEPS=[
        "query_planner",
        "query_test_service_context",
    ],
    CONSOLIDATED_TARGET="query_bm",
)

env.Library(
    target="query_bm_constants",
    source=["query_bm_constants.cpp"],
    LIBDEPS_PRIVATE=["$BUILD_DIR/mongo/base"],
)

bmEnv = env.Clone()
bmEnv.InjectThirdParty(libraries=["benchmark"])

bmEnv.Library(
    target="query_bm_fixture",
    source=["query_bm_fixture.cpp"],
    LIBDEPS=[
        "$BUILD_DIR/mongo/db/catalog/catalog_test_fixture",
        "$BUILD_DIR/mongo/db/query_exec",
        "$BUILD_DIR/mongo/db/read_write_concern_defaults_mock",
        "$BUILD_DIR/mongo/db/repl/storage_interface_impl",
        "$BUILD_DIR/mongo/db/service_context_d",
        "$BUILD_DIR/third_party/benchmark/benchmark",
    ],
)

env.Benchmark(
    target="point_query_bm",
    source=[
        "point_query_bm.cpp",
    ],
    LIBDEPS=["query_bm_fixture"],
    CONSOLIDATED_TARGET="query_bm",
)

env.Benchmark(
    target="complex_query_bm",
    source=[
        "complex_query_bm.cpp",
    ],
    LIBDEPS=["query_bm_constants", "query_bm_fixture"],
    CONSOLIDATED_TARGET="query_bm",
)
